<?php 
$rank = 1;
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
	$rank = 4;
}elseif (isset($_SERVER['HTTP_X_PROXY_ID']) or isset($_SERVER['HTTP_VIA']) or isset($_SERVER['HTTP_PROXY_CONNECTION'])){
	$rank = 3;
}elseif (isset($_SERVER['HTTP_CONNECTION']) and 'close'==$_SERVER['HTTP_CONNECTION'] or isset($_SERVER['HTTP_CACHE_CONTROL']) ){
	$rank = 2;
}
header('Content-Type: application/json; charset=utf-8');
echo json_encode($rank);
var_dump($_SERVER);